<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@include file="../base.jsp"%> 
<sys:genericTag4o id="deptList" methodName="getDeptList" className="com.tmpt.controller.taglib.SecurityTag"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>    
<link href="../css/main.css" rel="stylesheet" type="text/css" >
<link rel="stylesheet" type="text/css" href="${path}/js/jquery/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="${path}/js/jquery/easyui/themes/icon.css">
<script type="text/javascript" src="${path}/js/jquery/easyui/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="${path}/js/jquery/easyui/jquery.easyui.min.js"></script>

<script type="text/javascript">
function submit1(){  
    if(!$('#form1').form('validate')){
		alert('数据填写不完整');
		return;
	}
    $('#addDeptId').val('处理中..');
    $("#addDeptId").attr({"disabled":"disabled"});
    document.form1.submit();
}
function deleteSelected(id){
    if(!confirm('确定删除吗？')){
        return false;
    }

    $('#deptId').val(id);
    $('#form2').submit();
}
</script>
</head>

<body class="font14">
<div style="color: red; text-align: center;">
	<s:property value="#attr.result"/>
</div>
<s:form name = "form1" id = "form1" action="user_addDept.action" namespace="/admin123/user" theme="simple">
<table class="table1" align="center" width="400">
	<thead>
		<tr>
			<td align="center"  colspan="2">增加部门</td>
		</tr>
	</thead>
	<tr>
		<td>部门名称:<input name="deptName" maxlength="20" class="easyui-validatebox" data-options="required:true"/></td>
		<td> 
			<input type="button" id="addDeptId" value="增加" onclick="submit1()">
		</td>
	</tr>
</table>
</s:form>
<br/>
<s:form name = "form2" id = "form2" action="user_delDept.action" namespace="/admin123/user" theme="simple">
<input type="hidden" name="deptId" id="deptId"/>
<table class="table1" cellpadding="0" cellspacing="0" align="center" width="400">
	<thead>
		<tr>
			<td align="center" colspan="2">部门列表</td>
		</tr>
	</thead>
	<tr>
		<td align="center">部门名称</td>
		<td align="center">操作</td>
	</tr>
	<s:iterator value="#attr.deptList">
	<tr>
		<td align="center">
			${attr.name}
		</td>
		<td align="center">
            <a id="deleteSelected_Filter" onclick="deleteSelected(${id});" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-cancel'"></a>
        </td>
	</tr>
	</s:iterator>
</table>
</s:form>
  
</body>

    
</html>